package com.example.tests;

import static org.junit.Assert.assertEquals;

import org.junit.*;

import com.eample.pages.UserPage;

public class DDelEditor extends TestBase {

	@Test
	public void testUntitled() throws Exception {
		UserPage userPage = goToMainPage()
			.LoginWithValidCredentials("admin","admin")
			.GotoUserManagement();

		SortedListOf<User> oldUserList = userPage.getUsers();

		User user = new User().withName("editor").withEmail("editor@test.com")
				.withPassword("editor");

		if (oldUserList.contains(user)) {
			userPage.deleteUser(user);
		} else {
			userPage.InsUser(user);
			oldUserList = userPage.getUsers();
			userPage.deleteUser(user);
		}
		SortedListOf<User> newUserList = userPage.getUsers();

		assertEquals(newUserList, oldUserList.without(user));
		
		userPage.logout();

	}

}
